package com.ddwl.common.util;

import org.springframework.util.StringUtils;

/**
 * 类CommonUtils.java的实现描述：TODO
 *
 * @author zach
 * @Date :2020-09-03 20:05.
 */
public class CommonUtils {

    // 手机号码前三后四脱敏
    public static String mobileEncrypt(String mobile) {
        if (!StringUtils.hasText(mobile) || (mobile.length() != 11)) {
            return mobile;
        }
        return mobile.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2");
    }
}
